﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace LuShanTea.Front.Web.App_Start
{
    [AttributeUsage( AttributeTargets.Property,AllowMultiple =false)]
    public class ValidateOperationAttribute:ValidationAttribute
    {
        public ValidateOperationAttribute()
        {
            this.ErrorMessage = "运算符错误";
        }

        public override bool IsValid(object value)
        {
            string operation = (string)value;
            operation = operation.TrimStart();
            if (operation!="加"|| operation!="减")
            {
                return false;
            }
            return true;
        }

    }
}